import java.util.*;
public class Test2 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        boolean[] arr=new boolean[11];
        String[] scc=str.split("\\,");
        for (int i = 0; i < scc.length; i++) {
            int a=Integer.valueOf(scc[i]);
            arr[a]=true;
        }
        int count=0;
        for (int i = 1; i <=5; i++) {
            if(arr[i]==false) {
                System.out.print(i+" ");
                count++;
            }
        }
        if(count==0){
            System.out.print("第1小队都有得票");
        }
        System.out.println();
        count=0;
        for (int i = 6; i <=10 ; i++) {
            if(arr[i]==false){
                System.out.print(i+" ");
                count++;
            }
        }
        if(count==0){
            System.out.print("第2小队都有得票");
        }
    }
}
